require('isomorphic-fetch');

const apiPrefix = '//jsonplaceholder.typicode.com';

const fetchPosts = () => {
  return fetch(`${apiPrefix}/posts`)
  .then( resp => {
    console.log('response status: ', resp.status);
    console.log('response message: ', resp.statusText);
    return resp.json();
  })
  .then( json => {
    console.log('response json data: ', JSON.stringify(json.slice(0,2), ' ', 2));
  });
}

fetchPosts();
